import request from '@/utils/request'

/**
 * 签章配置列表
 * @param {*} data
 *
 */
export function getSignatureList(data) {
    return request({
        url: 'sealSubject/queryPageList',
        method: 'post',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        data: data
    })
}

/**
 * 添加配置主体
 * @param {*} data
 *
 */
export function addSignature(data) {
    return request({
        url: 'sealSubject/add',
        method: 'post',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        data: data
    })
}

/**
 * 全量印章主体
 */
export function queryAllSignatureList(data) {
    return request({
        url: 'sealSubject/queryList',
        method: 'post',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        data: data
    })
}

// ==================================
/**
 * 获取模板列表
 */
export function getTemplateList(data) {
    return request({
        url: 'template/queryPageList',
        method: 'post',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        data: data
    })
}

/**
 * 获取全量模板列表
 */
export function getTemplateAllList(data) {
    return request({
        url: 'template/queryList',
        method: 'post',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        data: data
    })
}

/**
 * 添加模板列表
 */
export function addTemplate(data, query) {
    return request({
        url: 'template/add',
        method: 'post',
        headers: {
            'Content-Type': 'application/json'
        },
        params: query,
        data: data
    })
}

/**
 * 修改更新模板列表
 */
export function updateTemplate(data, query) {
    return request({
        url: 'template/update',
        method: 'post',
        headers: {
            'Content-Type': 'application/json'
        },
        params: query,
        data: data
    })
}

/**
 * 模板详情
 */
export function getTemplateInfo(query) {
    return request({
        url: 'template/getTemplateInfo',
        method: 'get',
        headers: {
            'Content-Type': 'application/json'
        },
        params: query,
    })
}

/**
 * 获取预览地址
 */
export function getTemplatePreviewUrl(query) {
    return request({
        url: 'template/previewUrl',
        method: 'get',
        headers: {
            'Content-Type': 'application/json'
        },
        params: query,
    })
}
/**
 * 更新模板状态
 */
export function upStateTemplate(query) {
    return request({
        url: 'template/upStatus',
        method: 'get',
        headers: {
            'Content-Type': 'application/json'
        },
        params: query,
    })
}

/**
 * 删除模板
 */
export function delTemplate(query) {
    return request({
        url: 'template/delTemplate',
        method: 'get',
        headers: {
            'Content-Type': 'application/json'
        },
        params: query,
    })
}
// ==================================
/**
 * 获取签署记录列表
 */
export function getAgreementList(data) {
    return request({
        url: 'crmAgreement/queryPageList',
        method: 'post',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        data: data
    })
}

/**
 * 获取协议数量
 */
export function getContractStatis(data) {
    return request({
        url: 'crmAgreement/contractStatis',
        method: 'get',
        data: data
    })
}

/**
 * 通过协议编号 获取合同地址
 */
export function getCheckContract(data) {
    return request({
        url: 'crmAgreement/checkContract',
        method: 'get',
        params: data
    })
}

/**
 * 获取列表表头
 */
export function getCrmField(data) {
    return request({
        url: 'crmField/queryListHead/28',
        method: 'post',
        params: data
    })
}

/**
 * 导出
 */
export function exportAllExportExcel(data) {
    return request({
        url: 'crmAgreement/allExportExcel',
        method: 'post',
        responseType: 'blob',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        params: data
    })
}


// ========
/**
 * 获取学员协议列表
 */
export function getStuAgreement(data) {
    return request({
        url: 'crmAgreement/queryAgreement',
        method: 'post',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        data: data
    })
}

/**
 * 获取协议数量
 */
export function getContractNum(data) {
    return request({
        url: 'crmAgreement/contractNum',
        method: 'get',
        params: data
    })
}

/**
 * 发起签署
 */
export function addSign(data) {
    return request({
        url: 'crmAgreement/add',
        method: 'post',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        data: data
    })
}

/**
 * 是否可以发起签署
 */
export function canSubmit(data) {
    return request({
        url: 'crmAgreement/canSubmit',
        method: 'get',
        data: data
    })
}

/**
 * 三要素验证
 */
export function personAuth(data) {
    return request({
        url: 'crmAgreement/personAuth',
        method: 'get',
        params: data
    })
}